<template>
	<view>
		<view class="top">
			<view class="top_view cflex">
				<image :src="head_image" mode="aspectFit" class="avater"></image>
				<view class="userName">{{name}}</view>
				
				<image src="../../static/dxy-image/shezhi.png" mode="" class="top_shezhi" @tap="toSet"></image>
			</view>
		</view>

		<view class="block1 cflex cflex_around">
			<view class="block1_view flex" @tap="tp('../dxy_purchase/message/message')">
				<image src="../../static/dxy-image/zhongxin.png"></image>
				<view>消息中心</view>
			</view>
			<view class="block1_view flex" @tap="tp('../dxy_purchase/myStepAndCollection/myStepAndCollection?type=1')">
				<image src="../../static/dxy-image/zuji_1@3x.png"></image>
				<view>商品足迹</view>
			</view>
			<view class="block1_view flex"@tap="tp('../dxy_purchase/myStepAndCollection/myStepAndCollection?type=2')">
				<image src="../../static/dxy-image/shoucang_1@3x.png"></image>
				<view>商品收藏</view>
			</view>
			<view class="block1_view flex" @tap="tp('../dxy_purchase/Feedback/Feedback')">
				<image src="../../static/dxy-image/yijian_1@3x.png"></image>
				<view>个人意见</view>
			</view>
		</view>

		<view class="block2 flex " v-if="classType==1" >
			<view class="block2_tit">
				我的订单
			</view>
			<view class="cflex cflex_around" style="margin-top: 40rpx;">
				<view class="block2_view flex" @tap="tp('../orderList/orderList?type=1')">
					<image src="../../static/dxy-image/quanbu_1@3x.png"></image>
					<view>全部</view>
				</view>
				<view class="block2_view flex"@tap="tp('../orderList/orderList?type=3')">
					<image src="../../static/dxy-image/daifahuo_1@3x.png"></image>
					<view>待发货</view>
				</view>
				<view class="block2_view flex"@tap="tp('../orderList/orderList?type=4')">
					<image src="../../static/dxy-image/fahuo_1@3x.png"></image>
					<view>已发货</view>
				</view>
				<view class="block2_view flex"@tap="tp('../orderList/orderList?type=5')">
					<image src="../../static/dxy-image/daipingjia_4@3x.png"></image>
					<view>已完成</view>
				</view>
			</view>
			<view class="cflex" style="margin-top: 20rpx;">
				<view class="block1_view flex" @tap="tp('../dxy_purchase/myXunjia/myXunjia?type=1')">
					<image src="../../static/dxy-image/xunjia_1@3x.png"></image>
					<view>我的询价</view>
				</view>
				<view class="block1_view flex">
					<image src="../../static/dxy-image/baojiabiao.png"></image>
					<view>报价表</view>
				</view>
			</view>
		</view>

		<view class="block3 cflex cflex_around" v-if="classType==2" >
			<view class="block1_view flex" @click="mygoods()">
				<image src="../../static/dxy-image/shangpin_1@3x.png"></image>
				<view>我的商品</view>
			</view>
			<view class="block1_view flex">
				<image src="../../static/dxy-image/yijia_1@3x.png"></image>
				<view>我的议价</view>
			</view>
			<view class="block1_view flex">
				<image src="../../static/dxy-image/baojia_1_1@3x.png"></image>
				<view>我的报价</view>
			</view>
			<view class="block1_view flex">
				<image src="../../static/dxy-image/dindan_1@3x.png"></image>
				<view>订单管理</view>
			</view>
		</view>

		<view class="block4 cflex " v-if="classType==3" >
			<view class="block1_view flex" @click="mygoods()">
				<image src="../../static/dxy-image/guanli_1@3x.png"></image>
				<view>商品管理</view>
			</view>
			<view class="block1_view flex" @click="myxuanjia()">
				<image src="../../static/dxy-image/xunjiaguanli_1@3x.png"></image>
				<view>询价管理 </view>
			</view>
			<view class="block1_view flex">
				<image src="../../static/dxy-image/baojia_1@3x.png"></image>
				<view>报价管理</view>
			</view>
			<view class="block1_view flex">
				<image src="../../static/dxy-image/kehu.png"></image>
				<view>我的客户</view>
			</view>
			<view class="block1_view flex">
				<image src="../../static/dxy-image/shenhe_1@3x.png"></image>
				<view>评价审核</view>
			</view>
			<view class="block1_view flex">
				<image src="../../static/dxy-image/tiwen_1@3x.png"></image>
				<view>提问审核</view>
			</view>
			<view class="block1_view flex">
				<image src="../../static/dxy-image/huida_1@3x.png"></image>
				<view>回答审核</view>
			</view>
		</view>


		<uniTabBar1 :current="currentIndex" style="z-index:999;" v-if="classType==1 || classType==3" />
		<uniTabBar2 :current="currentIndex" style="z-index:999;" v-if="classType==2 || classType==4" />
	</view>
</template>

<script>
	
	import uniTabBar1 from '../../components/uni-tabBar1';
	import uniTabBar2 from '../../components/uni-tabBar1';
	import {
		ajax
	} from '../../ajax.js';
	export default {
		data() {
			return {
				head_image: "",
				level: "",
				mobile: "",
				name: "",
				classType:'',
				currentIndex:4,
			}
		},
		components: {
			uniTabBar1,
			uniTabBar2
		},
		onLoad() {
			let that = this
			that.classType = uni.getStorageSync('class')
			that.getUser()
		},
		methods: {
			tp(e){
				let that=this
				let url=e
				uni.navigateTo({
					url:url
				})
			},
			mygoods(){
				uni.navigateTo({
					url:'/pages/mine/mygoods'
				})
			},
			myxuanjia(){
				uni.navigateTo({
					url:'/pages/mine/myxuanjia'
				})
			},
			getUser() {
				let that = this
				let token = uni.getStorageSync("token")
				console.log("token", token)
				ajax({
					url: 'user/getUser',
					data: {
						token: token
					},
					header: {
						'content-type': 'application/json' //自定义请求头信息
					},
					method: 'POST',
					success: function(res) {
						that.head_image=res.data.data.head_image
						that.mobile=res.data.data.mobile
						that.name=res.data.data.name
				        console.log("token", res.data)
					},
					error: function() {

					}
				});
			},
			toSet(){
				let that=this
				uni.navigateTo({
					url:"/pages/set/set"
				})
			},

			inputphone() {

			},
			inputName() {}
		}
	}
</script>

<style>
	.top {
		background-color: #FF7427;
	}

	.top_view {
		height: 100rpx;
		padding-top: 100rpx;
		padding-bottom: 100rpx;
		line-height: 100rpx;
	}

	.avater {
		width: 98rpx;
		height: 98rpx;
		border-radius: 100px;
		margin-right: 20rpx;
		margin-left: 20rpx;
		/* margin-top: 90rpx;
		margin-left: 22rpx; */
	}

	.userName {
		color: #FFFFFF;
		font-size: 28rpx;
	}

	.top_shezhi {
		height: 40rpx;
		width: 40rpx;
		margin-top: 30rpx;
		position: absolute;
		right: 40rpx;
	}

	.block1,
	.block2,
	.block3,
	.block4 {
		background-color: #FFFFFF;
		border-radius: 20rpx;
		box-shadow: 0 0rpx 10rpx 5rpx #EAEAEA;
		width: 710rpx;
		margin: 0 auto;
	}

	.block1 {
		height: 188rpx;

		position: absolute;
		top: 240rpx;
		left: 20rpx;
	}

	.block1_view {
		width: 25%;
		text-align: center;
		font-size: 28rpx;
		margin-top: 36rpx;
	}

	.block1_view>image {
		width: 74rpx;
		height: 74rpx;
	}

	.block2 {
		width: 710rpx;
		height: 410rpx;
		background-color: #FFFFFF;
		margin-top: 150rpx;
	}

	.block2_view {
		margin: 0 auto;
		text-align: center;
		font-size: 28rpx;
	}

	.block2_view>image {
		width: 43rpx;
		height: 43rpx;
	}

	.block2_tit {
		font-size: 28rpx;
		margin-left: 20rpx;
		padding-top: 20rpx;
	}

	.block1_view2>image {
		width: 74rpx;
		height: 74rpx;
	}

	.block1_view2 {
		margin-left: 80rpx;
	}

	.block3 {
		margin-top: 158rpx;
		height: 205rpx;
		padding-top: 20rpx;
	}

	.block4 {
		height: 334rpx;
		margin-top: 158rpx;
		flex-wrap: wrap;
		margin-bottom: 100rpx
	}
</style>
